package com.example.javachatroomextend.mapper;

import com.example.javachatroomextend.model.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper {
    @Select("select userId,username,password,image from user where username=#{username}")
    User getUserByName(@Param("username") String username);

    @Insert("insert into user(username,password,image) values(#{username},#{password},#{image})")
    Integer addUser(@Param("username") String username,@Param("password") String password,@Param("image") String image);

    @Select("select username,image from user where userId=#{userId}")
    User getUserByUserId(@Param("userId") Integer userId);
}
